package com.ethan.http;

import com.alibaba.dubbo.common.json.JSON;
import com.ethan.http.tgq.*;
import com.google.common.collect.Lists;
import qunar.api.pojo.Money;

import java.io.IOException;
import java.net.URLEncoder;
import java.util.List;

/**
 * @author ethan
 * create 2018-06-06 下午12:06
 * desc
 **/
public class HttpTest5 {
    public static void main(String[] args) throws IOException {
//        TgqRuleInfoDataParam tgqRuleInfoDataParam = new TgqRuleInfoDataParam();
//        tgqRuleInfoDataParam.setType(1);
//        AdultTgqRuleDataParam adultTgqRuleDataParam = new AdultTgqRuleDataParam();
//        adultTgqRuleDataParam.setBasePrice(Money.of(10));
//        tgqRuleInfoDataParam.setAdultTgqRule(adultTgqRuleDataParam);
//        String json = JSON.json(tgqRuleInfoDataParam);

//        int id=7770;
//        List<TgqRuleInfoParam> list = Lists.newArrayList();
//        TgqRuleInfoParam tgqRuleInfoParam = new TgqRuleInfoParam();
//        tgqRuleInfoParam.setType(1);
//
//        List<TimePointChargesParam> timePointChargesParamList = Lists.newArrayList();
//        TimePointChargesParam pointChargesParam = TimePointChargesParam.builder().returnFee(Money.of(15)).build();
//        timePointChargesParamList.add(pointChargesParam);
//
//        AdultTgqRuleParam adultTgqRuleParam = new AdultTgqRuleParam();
//        adultTgqRuleParam.setBasePrice(Money.of(20));
//        adultTgqRuleParam.setTimePointChargesList(timePointChargesParamList);
//        tgqRuleInfoParam.setAdultTgqRule(adultTgqRuleParam);
//
//        list.add(tgqRuleInfoParam);
//        String str =JSON.json(list);
//
//        String site="xep.trade.qunar.com";
//        String url ="http://l-noahcgwpqmeh1.auto.beta.cn0.qunar.com:8080/justfortest/updateTgqRuleInfo?id="+id+"&tgqRuleInfoParamList="+ URLEncoder.encode(str)+"&site="+site;
//
//        String result = HttpUtils2.get(url);

        test();

        String a ="";
    }


    private static void  test() {
        String str ="航班起飞前2小时之前,退票手续费为75元;航班起飞前2小时之后,退票手续费为100元222";
        str = URLEncoder.encode(str);
        //7770
        String url =String.format("http://l-noahifkag8jw1.auto.beta.cn0.qunar.com:8080/justfortest/updateTgqRuleInfo2?type=%d&id=%s&basePrice=%d&cbasePrice=%d&timeReturnFee=%d&cChangeFee=%d&site=%s&refundRules=%s",1,1017,205,10,40,11,"xep.trade.qunar.com",str);
        String result = HttpUtils2.get(url);

        String a ="";
    }
}
